package com.study.jdbc.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
* @Name: PropertiesUtil
* @Description: 资源配置文件读取工具类
* @Author: 李超	lc_jack@foxmail.com
* @CreateDate: 2017-2-16 下午8:38:59 
* @Version: V1.0
 */
public class PropertiesUtil {
	
	private static final String PROPPATH = "com/study/jdbc/beans.properties" ;
	
	private static Properties prop = null ;

	static {
		ClassLoader loader = PropertiesUtil.class.getClassLoader() ;
		InputStream in = loader.getResourceAsStream(PROPPATH) ;
		prop = new Properties() ;
		try {
			prop.load(in) ;
		} catch (IOException e) {
			System.out.println("资源文件读取失败！");
			e.printStackTrace();
		}
	}
	
	public static String getValueByKey(String key) {
		return prop.getProperty(key) ;
	}
}
